using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ManagementClinic.Data.Models.Mapping
{
    public class USERMap : EntityTypeConfiguration<USER>
    {
        public USERMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.MA)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.TEN)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.KY_HIEU)
                .HasMaxLength(10);

            this.Property(t => t.USER_NAME)
                .HasMaxLength(20);

            this.Property(t => t.PASSWORD)
                .HasMaxLength(100);

            this.Property(t => t.GHI_CHU)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("USERS");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.MA).HasColumnName("MA");
            this.Property(t => t.TEN).HasColumnName("TEN");
            this.Property(t => t.KY_HIEU).HasColumnName("KY_HIEU");
            this.Property(t => t.USER_NAME).HasColumnName("USER_NAME");
            this.Property(t => t.PASSWORD).HasColumnName("PASSWORD");
            this.Property(t => t.GHI_CHU).HasColumnName("GHI_CHU");
        }
    }
}
